package servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import domain.Table;
import domain.extra.Result;

public class SpinServlet extends HttpServlet{
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
			IOException {

		Table table = (Table)request.getSession().getAttribute("table");
		
		table.rouletteSpin(); 
		Result winner = table.getActualNumber();

		request.getSession().setAttribute("winner", winner);
		
		request.getRequestDispatcher("numberWinner.jsp").forward(request, response);
	}
}
